package com.dmn.gcode.springchains.adapters;

import com.dmn.gcode.springchains.core.In;

import java.util.ArrayList;
import java.util.List;

/**
 * date 1/21/11
 *
 * @author dvponomarev
 * @version 1.0
 */
public class ListAdapter<T> implements In<List<T>> {
    private List<In<T>> list;

    public void setList(List<In<T>> list) {
        this.list = list;
    }

    public List<T> get() {
        if (list == null) {
            return null;
        }
        List<T> result = new ArrayList<T>(list.size());
        for (In<T> element : list) {
            result.add(element.get());
        }
        return result;
    }
}
